package com.zork.cmdb.webapi.service.impl;

import com.zork.cmdb.webapi.domain.dto.UserDTO;
import com.zork.cmdb.webapi.domain.vo.UserVO;
import com.zork.cmdb.webapi.mapper.cmdb.UserMapper;
import com.zork.cmdb.webapi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chenjh
 * @date 2018/5/9
 * @description
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<UserVO> listUser() {
        List<UserDTO> userDTOList = userMapper.listUser();
        List<UserVO> userVOList = com.zork.cmdb.webapi.domain.mapper.UserMapper.MAPPER.getVOList(userDTOList);
        return userVOList;
    }

    @Override
    public UserVO getUser(Long id) {
        UserDTO userDTO = userMapper.getUser(id);
        UserVO userVO = com.zork.cmdb.webapi.domain.mapper.UserMapper.MAPPER.getVO(userDTO);
        return userVO;
    }
}
